{template 'common/header'}

{template 'common'}
<ul class="nav nav-tabs">
	<li {if $operation == 'display' && $status == ''}class="active"{/if}>
	<a href="{php echo $this->createWebUrl('order', array('op' => 'display'))}">全部订单</a>
	</li>
	<li {if $operation == 'display' && $status == '3'}class="active"{/if}>
	<a href="{php echo $this->createWebUrl('order', array('op' => 'display', 'status' => 3))}">已完成</a>
	</li>
	<li {if $operation == 'display' && $status == '1' && ( $sendtype=='1' || $sendtype=='0')} class="active"{/if}>
	<a href="{php echo $this->createWebUrl('order', array('op' => 'display', 'status' => 1))}">未鉴定</a>
	</li>
	<!--<li {if $operation == 'display' && $status == '1' && $sendtype == '2'}class="active"{/if}>-->
	<!--<a href="{php echo $this->createWebUrl('order', array('op' => 'display', 'status' => '1', 'sendtype' => 2))}">待自提</a>-->
	<!--</li>-->
	<!--<li {if $operation == 'display' && $status == '0'}class="active"{/if}>-->
	<!--<a href="{php echo $this->createWebUrl('order', array('op' => 'display', 'status' => 0))}">待付款</a>-->
	<!--</li>-->
	<!--<li {if $operation == 'display' && $status == '2'}class="active"{/if}>-->
	<!--<a href="{php echo $this->createWebUrl('order', array('op' => 'display', 'status' => 2))}">待收货</a>-->
	<!--</li>-->

	<li {if $operation == 'display' && $status == '-1'}class="active"{/if}>
	<a href="{php echo $this->createWebUrl('order', array('op' => 'display', 'status' => -1))}">无法鉴定</a>
	</li>
	<li {if $operation == 'display' && $refund == '1' }class="active"{/if}>
	<a href="{php echo $this->createWebUrl('order', array('op' => 'display', 'refund' => 1))}">申请退款</a>
	</li>
	<li {if $operation == 'display' && $refund == '2' }class="active"{/if}>
	<a href="{php echo $this->createWebUrl('order', array('op' => 'display', 'refund' => 2))}">已退款</a>
	</li>
	{if $operation == 'detail'}
	<li class="active">
		<a href="#">订单详情</a>
	</li>
	{/if}
</ul>


{if $commentlist}


<div class="main">


	<div class="panel panel-default">
		<div class="panel-body table-responsive">
			<table class="table table-hover">
				<thead class="navbar-inner">
				<tr>
					<th style="width:80px;">订单号</th>
					<th style="width:120px;">评论人</th>
					<th style="width:80px;">电话</th>
					<th style="width:100px;">评论内容</th>
					<th style="width:100px;">是否显示</th>
					<th style="width:120px; text-align:right;">操作</th>
				</tr>
				</thead>
				<tbody>
				{loop $commentlist $item}
				<tr>
					<td>{$item['orderid']}</td>
					<td>{$item['nickname']}</td>
					<td>{$item['phone']}</td>
					<td>{$item['content']}</td>
					<td style="width:100px;">
					
<label data="{$item['shows']}" class="label  label-default {if $item['shows']==1}label-info{/if}" onclick="setProperty(this,{$item['id']},'shows')">{if $item['shows']==1}显示{else}隐藏{/if}</label>


					</td>
					<td style="text-align: right">
						<a href="{php echo $this->createWebUrl('ordercommentdelete', array('orderid'=>$item['orderid'],'id' => $item['id']))}" onclick="return confirm('此操作不可恢复，确认删除？');"
						   class="btn btn-default btn-sm" data-toggle="tooltip" data-placement="bottom" title="删除"><i class="fa fa-times"></i>
						</a>
					</td>
				</tr>
				{/loop}
				</tbody>
			</table>
		</div>
	</div>
</div>
{$pager}
{else}
<div class="main">


	<div class="panel panel-default">
		<div class="panel-body table-responsive" style="text-align: center">
			<span>暂无评论</span>
		</div>
	</div>
</div>
{/if}
<script type="text/javascript">
	require(['daterangepicker'], function($){
		$('.daterange').on('apply.daterangepicker', function(ev, picker) {
			$('#form1')[0].submit();
		});
	});
</script>


<script>
	function setProperty(obj,id,type){
		$(obj).html($(obj).html() + "...");
		$.post("{php echo $this->createWebUrl('setordercommentsproperty')}"
			,{id:id,type:type, data: obj.getAttribute("data")}
			,function(d){
				$(obj).html($(obj).html().replace("...",""));
				
				if(type=='shows'){
				 $(obj).html( d.data=='1'?'显示':'隐藏');
				}
				$(obj).attr("data",d.data);
				if(d.result==1){
					$(obj).toggleClass("label-info");
				}
			}
			,"json"
		);
	}
	require(['bootstrap'],function($){
		$('.btn').hover(function(){
			$(this).tooltip('show');
		},function(){
			$(this).tooltip('hide');
		});
	});
</script>
{template 'common/footer'}